//
//  LZQ_NetworkReachability.swift
//  SwiftExercise
//
//  Created by King on 2021/6/18.
//

import UIKit
import Alamofire

class LZQ_NetworkReachability: NSObject {
    
    static let reachability = LZQ_NetworkReachability()
    
    var reachAble:Bool = {
        var reach = true
        let manager = NetworkReachabilityManager(host: "www.baidu.com")
        manager?.listener = { status in
            switch status{
            case .notReachable:
                reach = false
                SVProgressHUD.showError(withStatus: "网络出错")
            case .reachable(.ethernetOrWiFi):
                reach = true
            case .reachable(.wwan):
                reach = true
            case .unknown:
                reach = false
                SVProgressHUD.showError(withStatus: "未知网络")
            }
        }
        return reach
    }()
}
